<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>商户后台.</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="shortcut icon" href="__PUBLIC__/admin/favicon.ico">
    <link href="__PUBLIC__/admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/animate.css" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/style.css?v=4.1.0" rel="stylesheet">
</head>
<include file="Admin@Index:cache"/>
<body class="gray-bg contacts">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox">
                <div class="ibox-content">
                    <h2>客服账号管理</h2>

                    <div class="col-sm-12" style="margin-bottom: 1rem">
                        <form role="form" action="__SELF__" method="get">
                            <div class="form-group">
                                <!--<label>商品code</label>-->
                                <input type="text" id="content" placeholder="" name="content"
                                       class="form-control">
                            </div>
                            <div>
                                <button class="btn btn-sm btn-primary pull-right m-t-n-xs" type="submit" id="search">
                                    <strong>搜索</strong>
                                </button>
                            </div>
                        </form>
                    </div>
                    <br>
                    <table class="table table-striped table-hover">
                        <tbody>
                        <tr>
                            <th>账号</th>
                            <th class="">姓名</th>
                            <th>手机号</th>
                            <th>昵称</th>
                            <!--<th>跳转类型</th>-->
                            <th>QQ号</th>
                            <th>微信号</th>
                            <th class="">状态</th>
                            <th>创建时间</th>
                            <th class="client-status">操作</th>
                        </tr>
                        <foreach name="list" item="list">
                            <tr>
                                <td><{$list.account}></td>
                                <td><{$list.name}></td>
                                <td><{$list.mobile}></td>
                                <td><{$list.nickname}></td>


                                <td><{$list.qq}></td>
                                <td><{$list.wx}></td>
                                <td>
                                    <!--1启用2禁用-1删除-->
                                    <switch name="list.state">
                                        <case value="1">启用</case>
                                        <case value="2">禁止</case>
                                        <case value="-1">删除</case>
                                    </switch>
                                </td>
                                <td class=""><{$list.ctime}></td>
                                <td class="client-status">
                                    <!--<a class="btn btn-primary btn-rounded modify" href="javascript:void(0);"-->
                                       <!--onclick="add_kefu('<{$list.id}>')">添加资料</a>-->
                                    <a class="btn btn-success btn-rounded modify" href="javascript:void(0);"
                                       onclick="modify_kefu('<{$list.id}>','<{$list.nickname}>','<{$list.qq}>','<{$list.wx}>')">修改资料</a>

                                </td>
                            </tr>
                        </foreach>
                        </tbody>
                    </table>
                    <ul class="pagination">
                        <if condition="$tol gt 10">
                            <{$fpage}>
                        </if>
                    </ul>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- 全局js -->
<script src="__PUBLIC__/admin/js/jquery.min.js?v=2.1.4"></script>
<script src="__PUBLIC__/admin/js/bootstrap.min.js?v=3.3.6"></script>

<script src="__PUBLIC__/admin/js/plugins/layer/layer.min.js"></script>
<!-- 自定义js -->
<script src="__PUBLIC__/admin/js/content.js?v=1.0.0"></script>
<style>
    input::-webkit-outer-spin-button,
    input::-webkit-inner-spin-button {
        -webkit-appearance: none !important;
        margin: 0;
    }
</style>

<script>
    $(document).ready(function () {
        $('.contact-box').each(function () {
            animationHover(this, 'pulse');
        });
    });

    function modify_kefu(id,nickname,qq,wx) {
        var html = '';
        html += '<div class="modal-body" id="lists" style="height:100%">';
        html += '<form class="form-horizontal">';
        html += '<div class="form-group">';
        html += '<label class="col-sm-3 control-label" >昵称：</label>';
        html += '<div class="col-sm-8">';
        html += '<input  id="nickname" type="text" value="'+nickname+'" autocomplete="off" class="form-control" />';
        html += '</div>';
        html += '</div>';

        html += '<div class="form-group">';
        html += '<label class="col-sm-3 control-label" >QQ：</label>';
        html += '<div class="col-sm-8">';
        html += '<input  id="qq" type="number" value="'+qq+'" autocomplete="off" class="form-control" />';
        html += '</div>';
        html += '</div>';
        html += '<div class="form-group">';
        html += '<label class="col-sm-3 control-label" >微信：</label>';
        html += '<div class="col-sm-8">';
        html += '<input  id="wx" value="'+wx+'" autocomplete="off" class="form-control" />';
        html += '</div>';
        html += '</div>';
        html += '</form>';
        html += '<div class="modal-footer" style="border:0">';
        html += '<a href="javascript:void(0);" onclick="layer.closeAll()" type="button" class="btn btn-default" >关闭</a>';
        html += '<a href="javascript:void(0);" onclick="modify_kefus(\''+id+'\');" type="button" class="btn btn-primary" >修改</a>';
        html += '</div>';
        html += '</div>';

        layer.open({
            type: 1, //Page层类型
            area: ['500px', '400px'],
            title: '修改客服信息',
            shade: 0.6, //遮罩透明度
            maxmin: true, //允许全屏最小化
            anim: 1, //0-6的动画形式，-1不开启
            content: html
        });
    }

    function modify_kefus(id) {
        layer.confirm('是否确定修改？', function () {
            layer.load(2);
            $.post('__MODULE__/Systems/modify_kefu', {
                shop_id:id,
                nickname:$('#nickname').val(),
                qq:$('#qq').val(),
                wx:$('#wx').val()
//                link: $('#link').val()
            }, function (data) {
                layer.closeAll('loading');
                if (data.code == '1001') {
                    layer.closeAll();
                    layer.msg(data.result,{icon: 1,time:1000}, function(){
                        window.location.reload();
                    });

                } else {
                    if (data.status == '0') {
                        layer.msg(data.info, {time: 2000, icon: 5});
                    } else {
                        layer.msg(data.result, {time: 2000, icon: 5});
                    }
                }
            });
        });
    }

</script>


</body>

</html>
